#!/usr/bin/env bash

PROJECT_NAME="${PROJECT_NAME:-}"
PROJECT_DIR="/opt/$PROJECT_NAME"

pip install -r $PROJECT_DIR/requirements.txt -i https://pypi.douban.com/simple
if [[ $PROJECT_NAME = 'item_unifier' ]]; then
    # 此功能适用于item_unifier项目，并且字符替换只适用于python3.7版本
    #sed -i 's/+\#\&\\._/+\#\&\\._\\-γβλα\\(\\)\/Α%、（）“”/' /usr/local/lib/python3.7/site-packages/jieba/posseg/__init__.py
    sed -i 's/+\#\&\\._/+\#\&\\._\\-γβλα\\(\\)\/Α%、（）“”:/' /usr/local/lib/python3.7/site-packages/jieba/posseg/__init__.py
    # 数据与日志目录挂载
    # ln -sf $PROJECT_DIR/logs/ /opt/logs
    # ln -sf $PROJECT_DIR/exam_parser/file/ /opt/data
elif [[ $PROJECT_NAME = 'underwrite_core' ]]; then
    sed -i 's/+\#\&\\._/+\#\&\\._\\-><≥≤\\(\\)\/%ⅠⅡⅢⅣⅤ、,/' /usr/local/lib/python3.7/site-packages/jieba/posseg/__init__.py
fi
